package ming.model.type;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.StringUtils;

import ming.model.base.User;

@SuppressWarnings("serial")
@Entity
@Table(name = "T_TOBACCO_TERMINAL", schema = "")
public class Terminal implements java.io.Serializable {

    // Fields
    private Integer addboxnum1;
    private Integer addboxnum2;
    private Integer addboxnum3;
    private Integer addboxnum4;

    private String id;
    private String name;
    private String addr;
    private Integer cabon;
    private Integer cabonMax;
    private String telePhone;
    private String ip;
    private String passwd;
    private Integer equStatus;//终端机启动状态
    private Integer systemStatus;//系统运行状态
    private Integer printStatus;//打印状态
    private Integer runStatus;//重启、关机状态
    private String systemStartTime;
    private String systemUpdateTime;
    private String addPaperTime;
    private String clearCabonTime;
    private String msSendTime;
    private String cabonSendTime;
    private Set<User> users = new HashSet<User>(0);
    private Set<License> licenses = new HashSet<License>(0);
    private Set<Publish> publishs = new HashSet<Publish>(0);
    private Integer printSwitch;
    private String printMsg;
    private Integer systemSwitch;
    private String systemMsg;

    private Integer box1;
    private Integer box2;
    private Integer box3;
    private Integer box4;
    private Integer boxnum1;
    private Integer boxnum2;
    private Integer boxnum3;
    private Integer boxnum4;
    private Integer boxlimit1;
    private Integer boxlimit2;
    private Integer boxlimit3;
    private Integer boxlimit4;

    private Integer cpu;
    private Integer memory;
    private Integer inkbox;
    
    private String macAddress;//mac地址
    private Area area;
    
    //系统配置
    private String systemName;//系统名称
    private int refreshTime;//刷新时间
    private String printdriverstate;


    // Property accessors
    @Id
    @Column(name = "vcID", unique = true, nullable = false, length = 36)
    public String getId() {
        if (!StringUtils.isBlank(this.id)) {
            return this.id;
        }
        return UUID.randomUUID().toString();
    }

    public void setId(String id) {
        this.id = id;
    }

    @Column(name = "vcName", length = 100)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "vcAddr", length = 200)
    public String getAddr() {
        return this.addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }


    @Column(name = "intCabon")
    public Integer getCabon() {
        return cabon;
    }

    public void setCabon(Integer cabon) {
        this.cabon = cabon;
    }

    @Column(name = "intCabonMax")
    public Integer getCabonMax() {
        return cabonMax;
    }

    public void setCabonMax(Integer cabonMax) {
        this.cabonMax = cabonMax;
    }

    @Column(name = "vcTelePhone", length = 50)
    public String getTelePhone() {
        return telePhone;
    }

    public void setTelePhone(String telePhone) {
        this.telePhone = telePhone;
    }

    @Column(name = "vcIp", length = 300)
    public String getIp() {
        return this.ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Column(name = "vcPasswd", length = 100)
    public String getPasswd() {
        return this.passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    @Column(name = "intEquStatus")
    public Integer getEquStatus() {
        return this.equStatus;
    }

    public void setEquStatus(Integer equStatus) {
        this.equStatus = equStatus;
    }

    @Column(name = "intSystemStatus")
    public Integer getSystemStatus() {
        return this.systemStatus;
    }

    public void setSystemStatus(Integer systemStatus) {
        this.systemStatus = systemStatus;
    }

    @Column(name = "intPrintStatus")
    public Integer getPrintStatus() {
        return this.printStatus;
    }

    public void setPrintStatus(Integer printStatus) {
        this.printStatus = printStatus;
    }

    @Column(name = "intRunStatus")
    public Integer getRunStatus() {
        return this.runStatus;
    }

    public void setRunStatus(Integer runStatus) {
        this.runStatus = runStatus;
    }

    @Column(name = "dtSystemStartTime", length = 19)
    public String getSystemStartTime() {
        return this.systemStartTime;
    }

    public void setSystemStartTime(String systemStartTime) {
        this.systemStartTime = systemStartTime;
    }

    @Column(name = "dtAddPaperTime", length = 19)
    public String getAddPaperTime() {
        return this.addPaperTime;
    }

    public void setAddPaperTime(String addPaperTime) {
        this.addPaperTime = addPaperTime;
    }

    @Column(name = "dtclearCabonTime", length = 19)
    public String getClearCabonTime() {
        return clearCabonTime;
    }

    public void setClearCabonTime(String clearCabonTime) {
        this.clearCabonTime = clearCabonTime;
    }

    @Column(name = "dtMsSendTime", length = 19)
    public String getMsSendTime() {
        return msSendTime;
    }

    public void setMsSendTime(String msSendTime) {
        this.msSendTime = msSendTime;
    }

    @Column(name = "dtCabonSendTime", length = 19)
    public String getCabonSendTime() {
        return cabonSendTime;
    }

    public void setCabonSendTime(String cabonSendTime) {
        this.cabonSendTime = cabonSendTime;
    }

    @Column(name = "dtSystemUpdateTime", length = 19)
    public String getSystemUpdateTime() {
        return systemUpdateTime;
    }

    public void setSystemUpdateTime(String systemUpdateTime) {
        this.systemUpdateTime = systemUpdateTime;
    }

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "t_tobacco_user_terminal", schema = "", joinColumns = {@JoinColumn(name = "vcTerminal_ID", nullable = false, updatable = false)}, inverseJoinColumns = {@JoinColumn(name = "vcUser_ID", nullable = false, updatable = false)})
    public Set<User> getUsers() {
        return this.users;
    }

    public void setUsers(Set<User> users) {
        this.users = users;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "t_tobacco_license_terminal", schema = "", joinColumns = {@JoinColumn(name = "vcTerminal_ID", nullable = false, updatable = false)}, inverseJoinColumns = {@JoinColumn(name = "vcPrintType_ID", nullable = false, updatable = false)})
    public Set<License> getLicenses() {
        return this.licenses;
    }

    public void setLicenses(Set<License> licenses) {
        this.licenses = licenses;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "t_tobacco_publish_terminal", schema = "", joinColumns = {@JoinColumn(name = "vcTerminal_ID", nullable = false, updatable = false)}, inverseJoinColumns = {@JoinColumn(name = "vcPublish_ID", nullable = false, updatable = false)})
    public Set<Publish> getPublishs() {
        return this.publishs;
    }

    public void setPublishs(Set<Publish> publishs) {
        this.publishs = publishs;
    }



    @Transient
    public Integer getAddboxnum1() {
        return addboxnum1;
    }

    public void setAddboxnum1(Integer addboxnum1) {
        this.addboxnum1 = addboxnum1;
    }

    @Transient
    public Integer getAddboxnum2() {
        return addboxnum2;
    }

    public void setAddboxnum2(Integer addboxnum2) {
        this.addboxnum2 = addboxnum2;
    }

    @Transient
    public Integer getAddboxnum3() {
        return addboxnum3;
    }

    public void setAddboxnum3(Integer addboxnum3) {
        this.addboxnum3 = addboxnum3;
    }

    @Transient
    public Integer getAddboxnum4() {
        return addboxnum4;
    }

    public void setAddboxnum4(Integer addboxnum4) {
        this.addboxnum4 = addboxnum4;
    }


    @Column(name = "intPrintSwitch")
    public Integer getPrintSwitch() {
        return printSwitch;
    }

    public void setPrintSwitch(Integer printSwitch) {
        this.printSwitch = printSwitch;
    }

    @Column(name = "vcPrintMsg", length = 200)
    public String getPrintMsg() {
        return printMsg;
    }

    public void setPrintMsg(String printMsg) {
        this.printMsg = printMsg;
    }

    @Column(name = "intSystemSwitch")
    public Integer getSystemSwitch() {
        return systemSwitch;
    }

    public void setSystemSwitch(Integer systemSwitch) {
        this.systemSwitch = systemSwitch;
    }

    @Column(name = "vcSystemMsg", length = 200)
    public String getSystemMsg() {
        return systemMsg;
    }

    public void setSystemMsg(String systemMsg) {
        this.systemMsg = systemMsg;
    }

    @Column(name = "box1")
    public Integer getBox1() {
        return box1;
    }

    public void setBox1(Integer box1) {
        this.box1 = box1;
    }

    @Column(name = "box2")
    public Integer getBox2() {
        return box2;
    }

    public void setBox2(Integer box2) {
        this.box2 = box2;
    }

    @Column(name = "box3")
    public Integer getBox3() {
        return box3;
    }

    public void setBox3(Integer box3) {
        this.box3 = box3;
    }

    @Column(name = "box4")
    public Integer getBox4() {
        return box4;
    }

    public void setBox4(Integer box4) {
        this.box4 = box4;
    }

    @Column(name = "boxnum1")
    public Integer getBoxnum1() {
        return boxnum1;
    }

    public void setBoxnum1(Integer boxnum1) {
        this.boxnum1 = boxnum1;
    }

    @Column(name = "boxnum2")
    public Integer getBoxnum2() {
        return boxnum2;
    }

    public void setBoxnum2(Integer boxnum2) {
        this.boxnum2 = boxnum2;
    }

    @Column(name = "boxnum3")
    public Integer getBoxnum3() {
        return boxnum3;
    }

    public void setBoxnum3(Integer boxnum3) {
        this.boxnum3 = boxnum3;
    }

    @Column(name = "boxnum4")
    public Integer getBoxnum4() {
        return boxnum4;
    }

    public void setBoxnum4(Integer boxnum4) {
        this.boxnum4 = boxnum4;
    }

    @Column(name = "boxlimit1")
    public Integer getBoxlimit1() {
        return boxlimit1;
    }

    public void setBoxlimit1(Integer boxlimit1) {
        this.boxlimit1 = boxlimit1;
    }

    @Column(name = "boxlimit2")
    public Integer getBoxlimit2() {
        return boxlimit2;
    }

    public void setBoxlimit2(Integer boxlimit2) {
        this.boxlimit2 = boxlimit2;
    }

    @Column(name = "boxlimit3")
    public Integer getBoxlimit3() {
        return boxlimit3;
    }

    public void setBoxlimit3(Integer boxlimit3) {
        this.boxlimit3 = boxlimit3;
    }

    @Column(name = "boxlimit4")
    public Integer getBoxlimit4() {
        return boxlimit4;
    }

    public void setBoxlimit4(Integer boxlimit4) {
        this.boxlimit4 = boxlimit4;
    }


    @Column(name = "cpu")
    public Integer getCpu() {
        return cpu;
    }

    public void setCpu(Integer cpu) {
        this.cpu = cpu;
    }

    @Column(name = "memory")
    public Integer getMemory() {
        return memory;
    }

    public void setMemory(Integer memory) {
        this.memory = memory;
    }

    @Column(name = "inkbox")
    public Integer getInkbox() {
        return inkbox;
    }

    public void setInkbox(Integer inkbox) {
        this.inkbox = inkbox;
    }

    @Column(name = "macAddress", length = 64)
	public String getMacAddress() {
		return macAddress;
	}

	public void setMacAddress(String macAddress) {
		this.macAddress = macAddress;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "area")
	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	@Column(name = "systemName", length=100)
	public String getSystemName() {
		return systemName;
	}

	public void setSystemName(String systemName) {
		this.systemName = systemName;
	}

	@Column(name = "refreshTime")
	public int getRefreshTime() {
		return refreshTime;
	}

	public void setRefreshTime(int refreshTime) {
		this.refreshTime = refreshTime;
	}

    @Column(name = "printdriverstate")
    public String getPrintdriverstate() {
        return printdriverstate;
    }

    public void setPrintdriverstate(String printdriverstate) {
        this.printdriverstate = printdriverstate;
    }
}